<!--执行中-->
<template>
  <list class="list bg1" :loadmoreoffset="50" @loadmore="httpsRecordLoading">
    <refresh class="refresh" @refresh="httpsRecord" :display="isRefresh ? 'show' : 'hide'">
      <loading-indicator class="load text2"></loading-indicator>
    </refresh>

    <cell v-for="(item, index) in datas" v-bind:key="index">

      <div class="cell" v-if="item != ''">

          <div class="row acenter">
            <text class="font36 text2">{{"-"+" "+item.amount+" "+item.coinType+' '}}</text>
            <text class="font24 text3" v-if="item.coinType == 'VTN'">{{'(' + (item.isVtnEquity ? T('含提现权益') : T('不含提现权益')) + ')'}}</text>
      
            <div class="all"></div>
            <text class="font30 text3">{{T('普通划转')}}</text>
          </div>

          <div class="row acenter">
            <text class="font22 text3 all">{{item.createTime}}</text>
            <text class="font22 text2">{{walletd[item.fromWallet]}}</text>
            <text class="font22 text3">{{' '+T('到')+' '}}</text>
            <text class="font22 text2">{{walletd[item.toWallet]}}</text>
          </div>
        </div>

      <div class="genduo-bg" v-else>
        <text class="font22 text3">{{T('没有更多数据')}}</text>
      </div>
    </cell>
  </list>
</template>

<style src="@/_css/style.css" ></style>
<style scoped>
/*********************** 列表*/
.list {
  flex: 1;
}
.cell {
  flex-direction: column;
  justify-content: space-between;
  height:154px;
  border-radius:4px;

  margin-top: 20;
  margin-left: 20;
  margin-right: 20;
  padding: 30px;
}

/*********************** 刷新*/
.refresh {
  width: 750;
  flex-direction: row;
  justify-content: center;
}
.load {
  height: 40px;
  width: 40px;
}
.genduo-bg {
  flex-direction: row;
  justify-content: center;
  align-items: center;
  width: 750px;
  height: 100px;
}
</style>

<script>


//功能
import jmodal from "@/_js/modal";
import jtime from "@/_js/time";
import jhttps from "@/_js/https";

const weexFunction = weex.requireModule("WeexFunction");

import I18N from "@/_i18n/i18n";
var T = I18N.t;
weexFunction.setTitle(T('划转记录'));

export default {

  data() {
    return {
      T:T,
      
      isRefresh:false, //显示刷新
      isLoadinging:false, //显示加载
      pageNo:0, //页码
      pageMax:false, //turn最大页面

      datas:[], //执行列表-当前分类

      walletd:{'consumeWallet':T('消费账户'),
              'incomeWallet':T('收益账户'),
              'depositWallet':T('保证金账户')},//账户对照表
    };
  },

  mounted() {
    this.httpsRecord();
  },
  
  methods: {

    initData(datas) {
      for (let index = 0; index < datas.length; index++) {
        var data = datas[index];
        data.createTime = jtime.getTime(data.createTime, 'y/M/d H:m');
      }
      return datas;
    },

    /********************************** HTTP*/
    //划转记录-刷新
    httpsRecord() {
      if (this.isRefresh || this.isLoadinging) return;
      this.isRefresh = true;

      var param = {'pageNo':1};
      jhttps.post("wallet/queryTransferRecodeList",param,true,(data) => {
          this.isRefresh = false;

          if (data.status == 200) {
            this.datas = this.initData(data.data);
            this.pageNo = 1;
            this.pageMax = this.datas.length < 20;
            if(this.datas.length < 20) this.datas.push('');
          } else {
            jmodal.toast(data.msg);
          }
        }
      );
    },

    //划转记录加载-加载
    httpsRecordLoading() {
      if (this.pageMax || this.isRefresh || this.isLoadinging) return;
      this.isLoadinging = true;

      var param = {'pageNo': this.pageNo + 1};
      jhttps.post("wallet/queryTransferRecodeList",param,true,(data) => {
        this.isLoadinging = false;

        if (data.status == 200) {
          data = data.data;
          var datas = this.initData(data);
          this.datas.push(...datas);
          this.pageNo++;
          this.pageMax = datas.length < 20;
          if(datas.length < 20) this.datas.push('');
        } else {
          jmodal.toast(data.msg);
        }
      });
    },
  },
};

</script>
